'use strict';

/**
 * @ngdoc directive
 * @name nodeApp.directive:duoshuo
 * @description
 * # duoshuo
 */
app.directive('duoshuo', function ($location) {
  return {
    restrict: 'A',
    link: function postLink($scope,$this) {
      $scope.$on('finish-load-article',function(){
        var comment =angular.element('<div data-thread-key="'+$scope.article_id+'" data-title="'+$scope.title+'" data-url="'+$location.absUrl()+'"></div>');
        DUOSHUO.EmbedThread(comment[0]);
        $this.append(comment);
      })
    }
  };
});
